
package org.apache.mina.common;

import java.util.EventListener;

/**
 * Something interested in being notified when the result of an {@link IoFuture}
 * becomes available.
 * 
 * 当IoFuture的结果变成可活动时，对此监听器感兴趣的会被通知。
 */
public interface IoFutureListener extends EventListener {
    /**
     * An {@link IoFutureListener} that closes the {@link IoSession} which is
     * associated with the specified {@link IoFuture}.
     * 
     * IoFutureListener关闭与指定的IoFuture相关的IoSession。
     */
    static IoFutureListener CLOSE = new IoFutureListener() {
                                      public void operationComplete(
                                              IoFuture future) {
                                          future.getSession().close();
                                      }
                                  };

    /**
     * Invoked when the operation associated with the {@link IoFuture} has been
     * completed.
     * 
     * 当与IoFuture相关的操作被关闭时，调用此方法。
     * 
     * @param future
     *            The source {@link IoFuture} which called this callback.
     */
    void operationComplete(IoFuture future);
}